import { ADD_TODO} from '@/action-types';
import {Todo} from '@/models'
import {TodoAction} from '../actions/todoAction'
export interface TodoState {
    list:Array<Todo>
}
let initialState: TodoState = {list:new Array<Todo>()}
export default function (state: TodoState = initialState, action: TodoAction):TodoState{
    switch(action.type){
        case ADD_TODO:
            return {list:[...state.list,action.payload]};
        default:
            return state;
    }
}   